/*
 * 文件名：PushParkLot.java	 
 * 时     间：下午7:11:21
 * 作     者：Administrator       
 * 版     权： 2012-2022 湖南智软网络科技, 公司保留所有权利.
 * 联     系：http://www.073586.com/
 */
package com.local.manager.push;

import java.util.List;

import com.cz073586.message.websocket356.push.PushManager;
import com.cz073586.message.websocket356.transfer.TransferVo;
import com.local.entity.vo.CarBillVo;
import com.local.entity.vo.PushCarInOrOutInfoVo;
import com.local.model.Crossing;
import com.local.model.LocalStation;
import com.local.service.face.CrossingService;
import com.qianhai.common.utils.Log4jUtil;

/**
 * 类描述:推送车位信息
 * 
 * @ClassName: PushParkLot
 * @author Administrator
 * @date 2015年9月29日 下午7:11:21
 */
public class PushFtpPhototRunble implements Runnable
{
	private static Log4jUtil log = Log4jUtil
			.getLog4j(PushFtpPhototRunble.class);
	
	private CrossingService crossinService;
	
	private CarBillVo ftpInfo;
	
	public PushFtpPhototRunble(CrossingService crossinService, CarBillVo ftpInfo)
	{
		super();
		this.crossinService = crossinService;
		this.ftpInfo = ftpInfo;
	}
	
	@Override
	public void run()
	{
		
		try
		{
			PushCarInOrOutInfoVo pushInfo = new PushCarInOrOutInfoVo();
			
			pushInfo.setPic1(ftpInfo.getPic1());
			pushInfo.setPic2(ftpInfo.getPic2());
			// 通过设备编码查询路口数 这些查询需要放入线程里。TODO 张威
			List<Crossing> crossList = crossinService
					.queryCrossingByEquimentNo(ftpInfo.getEquipment());
			
			if (crossList.isEmpty())
			{
				return;
			}
			
			
			// 通过路口数查询需要推送多少个岗亭
			List<LocalStation> stationList = crossinService
					.queryStaionsByCrosList(crossList);
			pushInfo.setCrossList(crossList);
			pushInfo.setStationList(stationList);
			
			TransferVo<PushCarInOrOutInfoVo> trans = new TransferVo<PushCarInOrOutInfoVo>();
			trans.setEventType("ftpPhoto");
			
			trans.setData(pushInfo);
			PushManager.instance().pushMessage(trans);
		} catch (Throwable e)
		{
			log.error("", e);
		}
	}
}
